package com.iwhalecloud.citybrain.flow.platform.manager.application.common.enums;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * 日历类型
 *
 * @author wuliepeng
 * @date 2019-07-11
 */
public enum CalendarTypeEnum {

    WORKING_DAY("WORKING_DAY", "工作日"),

    CALENDAR_DAY("CALENDAR_DAY", "日历日");

    private String code;

    private String description;

    private static Map<String, String> codeToDesc = new HashMap<>();

    static {
        Arrays.asList(values()).forEach(item -> codeToDesc.put(item.getCode(), item.getDescription()));
    }

    CalendarTypeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public static String getDescrByCode(String code) {
        return codeToDesc.get(code);
    }

    public static Map<String, String> getCodeToDesc() {
        return codeToDesc;
    }

    public static void setCodeToDesc(Map<String, String> codeToDesc) {
        CalendarTypeEnum.codeToDesc = codeToDesc;
    }

}
